package com.lf.sys.util;

import org.apache.commons.lang3.StringUtils;

public class MailBean {
	private String host;// 服务器地址
	private String protocol;// 使用协议
	private String port;// 服务器端口

	private String auth;// 是否开启身份验证
	private String socketFactoryClass;// ssl连接类
	private String socketFactoryFallback;//
	private String socketFactoryPort;// ssl端口

	private String hostProp;//
	private String protocolProp;//
	private String portProp;//
	private String authProp;//
	private String socketFactoryClassProp;//
	private String socketFactoryFallbackProp;//
	private String socketFactoryPortProp;//

	private String account;// 账号
	private String password;// 密码

	private String nickname;// 昵称

	private boolean isSSL = false;// 是否ssl连接
	private boolean isSubmit = false;// 操作是否反馈到服务器

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public String getProtocol() {
		return protocol;
	}

	public void setProtocol(String protocol) {
		this.protocol = protocol;
	}

	public String getPort() {
		return port;
	}

	public void setPort(String port) {
		this.port = port;
	}

	public String getAuth() {
		return auth;
	}

	public void setAuth(String auth) {
		this.auth = auth;
	}

	public String getSocketFactoryClass() {
		return socketFactoryClass;
	}

	public void setSocketFactoryClass(String socketFactoryClass) {
		this.socketFactoryClass = socketFactoryClass;
	}

	public String getSocketFactoryFallback() {
		return socketFactoryFallback;
	}

	public void setSocketFactoryFallback(String socketFactoryFallback) {
		this.socketFactoryFallback = socketFactoryFallback;
	}

	public String getSocketFactoryPort() {
		return socketFactoryPort;
	}

	public void setSocketFactoryPort(String socketFactoryPort) {
		this.socketFactoryPort = socketFactoryPort;
	}

	public String getHostProp() {
		return hostProp;
	}

	public void setHostProp(String hostProp) {
		this.hostProp = hostProp;
	}

	public String getProtocolProp() {
		return protocolProp;
	}

	public void setProtocolProp(String protocolProp) {
		this.protocolProp = protocolProp;
	}

	public String getPortProp() {
		return portProp;
	}

	public void setPortProp(String portProp) {
		this.portProp = portProp;
	}

	public String getAuthProp() {
		return authProp;
	}

	public void setAuthProp(String authProp) {
		this.authProp = authProp;
	}

	public String getSocketFactoryClassProp() {
		return socketFactoryClassProp;
	}

	public void setSocketFactoryClassProp(String socketFactoryClassProp) {
		this.socketFactoryClassProp = socketFactoryClassProp;
	}

	public String getSocketFactoryFallbackProp() {
		return socketFactoryFallbackProp;
	}

	public void setSocketFactoryFallbackProp(String socketFactoryFallbackProp) {
		this.socketFactoryFallbackProp = socketFactoryFallbackProp;
	}

	public String getSocketFactoryPortProp() {
		return socketFactoryPortProp;
	}

	public void setSocketFactoryPortProp(String socketFactoryPortProp) {
		this.socketFactoryPortProp = socketFactoryPortProp;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public boolean isSSL() {
		return isSSL;
	}

	public void setSSL(boolean isSSL) {
		this.isSSL = isSSL;
	}

	public boolean isSubmit() {
		return isSubmit;
	}

	public void setSubmit(boolean isSubmit) {
		this.isSubmit = isSubmit;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public boolean isNull() {
		if (StringUtils.isNotBlank(this.getAccount()) && StringUtils.isNotBlank(this.getPassword())
				&& StringUtils.isNotBlank(this.getHost()) && StringUtils.isNotBlank(this.getProtocol())) {
			if (this.isSSL()) {
				if (StringUtils.isNotBlank(this.getSocketFactoryClass())
						&& StringUtils.isNotBlank(this.getSocketFactoryFallback())
						&& StringUtils.isNotBlank(this.getSocketFactoryPort())) {
					return false;
				}
			} else {
				if (StringUtils.isNotBlank(this.getPort())) {
					return false;
				}
			}
		}
		return true;
	}
}
